home *** CD-ROM | disk | FTP | other *** search
/ CD Ware Multimedia 1994 November / Cd Ware (Nro. 2) - Epimundo.iso / DOS / DB / FP_STR.ZIP / FP_STR.DOC < prev    next >
Encoding:
Text File  |  1994-03-17  |  3.9 KB  |  101 lines

  1. Cliper callable function:
  2. ******************************************************************************
  3. cString     := FP_STRING(nValue[,nPrec[,nRadix]])
  4.  
  5.     Function to convert a numeric value to a string.  Intended mainly for
  6.     diagnostic use, this function can generate sufficient digits to display
  7.     all precision available.
  8.  
  9.         nValue  Value to be converted.
  10.  
  11.         nPrec   Number of significant digits to be generated.  Precision is
  12.                 constrained to the inclusive range (4,52).  The following
  13.                 table indicates the limits of meaningful precision for
  14.                 standard radices:
  15.  
  16.                 Radix   Precision
  17.                   2         52
  18.                   8         18
  19.                  10         16
  20.                  16         13
  21.  
  22.         nRadix  Radix for conversion of normalized fraction digits.  The
  23.                 radix is constrained to the inclusive range (2,16).
  24.  
  25.     Three display formats are produced:
  26.  
  27.         . Standard decimal fixed-point representation:
  28.  
  29.             "[-]D,DDD,DDD,DDd.dddd dddd ∙∙∙ ."
  30.  
  31.             D,DDD ∙∙∙ will contain spaces for leading zeros. A sign, if 
  32.             present, will be positioned adjacent to the first digit.
  33.  
  34.         . Normalized to (1 <= value < 2) with a binary scale factor.
  35.           Fractional digits may be displayed in any radix from 2 to 16.
  36.  
  37.             "±1.dddd dddd ∙∙∙ B±eeee"       -1023 <= eeee <= 1024
  38.  
  39.             The ddd represent fractional digits in the specified radix and
  40.             ±eeee is a (decimally specified) binary scale factor.  The actual
  41.             value represented is (±1.dddd  ∙∙∙ dddd) * (2^±eeee) where "*"
  42.             and "^" indicate multiplication and exponentiation, respectively.
  43.  
  44.         . Standard Scientific Form
  45.  
  46.             "[-]D.dddd dddd ... e[-]nnn"
  47.  
  48.             D is a digit in the range (0,9); dddd ... are fractional places;
  49.             e[-]nnn represents a power of 10.  The actual value represented
  50.             is D.dddd ... dddd * 10^([-]nnn)
  51.  
  52.     Notes:  . For display in scientific form, transformation of values for
  53.               use with a decimal scale factor results in loss of accuracy.
  54.               
  55.             . If precision and radix are not specified, the defaults are
  56.               16 and 10, respectively.
  57.  
  58.             . Output form is dependent on explicit radix specification,
  59.               absolute magnitude of the value to be converted and a local
  60.               static variable (useSci).  See FP_SCI().
  61.  
  62.                 if (radix is specified explicitly)
  63.                 {
  64.                     Output form is normalized with binary scale factor.
  65.                 }
  66.                 else if (useSci >= 2)
  67.                 {
  68.                     Output form is scientific.
  69.                 }
  70.                 else if (.0001 <= v < 1,000,000,000)
  71.                 {
  72.                     if (useSci == 0)
  73.                         Output form is fixed-point decimal.
  74.                     else
  75.                         Output form is scientific.
  76.                     endif
  77.                 }
  78.                 else
  79.                 {
  80.                     Output form is normalized with binary scale factor.
  81.                 }
  82.                 endif
  83.  
  84.             . In fixed decimal format, leading zeros to the left of the
  85.               decimal point to not count toward satisfying the requested
  86.               precision.  In normalized, scaled format, the leading "1" does
  87.               not count toward satisfying the requested precision.
  88.  
  89. ******************************************************************************
  90. FP_SCI([nSci])
  91.  
  92.     Function to set useSci to control output form produced by FP_STRING().
  93.  
  94.     nSci    . If not specified or not a number, useSci is replaced by its
  95.               logical complement.
  96.  
  97.             . Valid states are 0, 1 and 2 no checking is done.
  98.  
  99. ******************************************************************************
  100.  
  101.